﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RelatorioSalas_Salas.aspx.cs" Inherits="InfraWEB.UI.RelatorioSalas_Salas" MasterPageFile="~/GerenteMaster.Master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
	<div>
		<h1 class="style3">Relatório de Salas por Itens Danificados</h1>
		<div class="error">
				<asp:Label runat="server" ID="lblMensagem" Visible="false"></asp:Label>
			    <br />
			</div>
			
			<asp:GridView ID="itemGridView" runat="server" CellPadding="4" 
                ForeColor="#333333" GridLines="None" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="SalId" 
                DataSourceID="SqlDataSource1">
                <RowStyle BackColor="#EFF3FB" />
                <Columns>
                    <asp:BoundField DataField="SalNome" HeaderText="Sala" 
                        SortExpression="SalNome" />
                    <asp:BoundField DataField="ItensDanificados" HeaderText="Itens Danificados"
                        SortExpression="ItensDanificados" />
                    <asp:BoundField DataField="PreNome" HeaderText="Prédio" 
                        SortExpression="PreNome" />
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
		    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:infraConnectionString %>" 
                SelectCommand="select S.SalId, SalNome,
                                    sum(LiiQuantidade) as ItensDanificados, PreNome
                                from dbo.ListaControleSala as LCS
                                inner join dbo.LCSItemInspecao as LCSII
                                    on LCS.LcsId = LCSII.LcsId
                                inner join dbo.TarefaInspecaoSala as TIS
                                    on TIS.TisId = LCS.TisId
                                inner join dbo.Predio as P
                                    on P.PreId = TIS.PreId
                                inner join dbo.Sala as S
                                    on S.SalId = LCS.SalId
                                group by S.SalId, SalNome, PreNome" >
            </asp:SqlDataSource>
	</div>
</asp:Content>
